# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: team/kde <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-applications
pkgname=spectacle
pkgver=23.08.4
pkgrel=0
pkgdesc="Application for capturing desktop screenshots"
# armhf blocked by extra-cmake-modules
# ppc64le, s390x and riscv64 blocked by qt5-qtwebengine -> purpose
arch="all !armhf !ppc64le !s390x !riscv64"
url="https://kde.org/applications/utilities/org.kde.spectacle"
license="GPL-2.0-only"
makedepends="
	extra-cmake-modules
	kconfig5-dev
	kcoreaddons5-dev
	kdbusaddons5-dev
	kdeclarative5-dev
	kdoctools5-dev
	ki18n5-dev
	kio5-dev
	knewstuff5-dev
	knotifications5-dev
	kpipewire-dev
	kwayland5-dev
	kwidgetsaddons5-dev
	kwindowsystem5-dev
	libkipi-dev
	libxcb-dev
	pipewire-dev
	purpose5-dev
	qt5-qtbase-dev
	qt5-qtx11extras-dev
	samurai
	xcb-util-cursor-dev
	xcb-util-image-dev
	xcb-util-renderutil-dev
	"
_repo_url="https://invent.kde.org/graphics/spectacle.git"
source="https://download.kde.org/stable/release-service/$pkgver/src/spectacle-$pkgver.tar.xz
	spectacle.desktop
	"
subpackages="$pkgname-doc $pkgname-lang"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

check() {
	ctest --test-dir build --output-on-failure
}

package() {
	DESTDIR="$pkgdir" cmake --install build

	install -Dm644 "$srcdir"/spectacle.desktop -t "$pkgdir"/etc/xdg/autostart/

	# We don't ship systemd
	rm -r "$pkgdir"/usr/lib/systemd
}
sha512sums="
a182d01edb74adea9a4762aeb95bda76dd01458212d78d3093d6d6663d0abbecb59e4862505813e9306be638d01d431eed1c35ad3ee1a413fe07871bdac71e79  spectacle-23.08.4.tar.xz
7c563d811f30d26f83e01a465e803b95167c5b2b842315257216ab282e07c69e7582a14d7f429cd19678199179ad8f3f2854265092f5a4c9ce9b65c87ed3849d  spectacle.desktop
"
